{include file="public/header" /}
<body>
<div class="layui-tab layui-tab-brief main-tab-container">
    <ul class="layui-tab-title main-tab-title">
        <li class="layui-this">广告添加</li>
        <div class="main-tab-item">内容管理</div>
    </ul>
    <div class="layui-tab-content">
        <form class="layui-form" onsubmit="return false;">
            <div class="layui-tab-item layui-show">
                <div class="layui-form-item">
                    <label class="layui-form-label">广告名称</label>
                    <div class="layui-input-inline input-custom-width">
                        <input type="text" name="title" value="" lay-verify="required" autocomplete="off" placeholder="请输入广告名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">广告图片</label>
                    <div class="layui-input-inline input-custom-width">
                        <input type="text" name="images" value="" lay-verify="required" autocomplete="off" placeholder="请输入广告图片链接" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">链接地址</label>
                    <div class="layui-input-inline input-custom-width">
                        <input type="text" name="link_url" value="" lay-verify="required" autocomplete="off" placeholder="请输入图片链接到的位置" class="layui-input">
                    </div>
                </div>

                <!--<div class="layui-form-item">-->
                <!--<label class="layui-form-label">发布时间</label>-->
                <!--<div class="layui-input-inline input-custom-width">-->
                <!--<input type="text" name="create_time" value="2017-02-24 21:47:42" id="date" lay-verify="datetime" placeholder="YYYY-MM-DD hh:mm:ss" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this,istime: 1, format: 'YYYY-MM-DD hh:mm:ss' })">-->
                <!--</div>-->
                <!--</div>-->
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="links_add" id="links_add">立即添加</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
    //添加操作
    $("#links_add").click(function(){
        $.ajax({
            url: "{:url('ad/add_ad')}",
            data: $("form").serialize(),
            type: "POST",
            datatype:"json",
            success: function( result ) {
                layer.open({
                    title: '信息'
                    ,content: '添加成功！'
                });
            }
        });
    });
</script>
<script type="text/javascript">
    layui.use(['element', 'form', 'upload', 'layedit', 'laydate'], function(){
        var element = layui.element()
            ,form = layui.form()
            ,layedit = layui.layedit
            ,laydate = layui.laydate
            ,jq = layui.jquery;
    })
</script>
</body>
</html>